<table class="table table-striped goods_list_table   table-bordered">
    <thead>
        <tr>
           <th class="opth50"><label>
          <input type="checkbox"  id="allsel" value="" > <span class="lbl"></span>
          </label></th>  
        	<th class="opth100">采购标题</th>
            <th class="opth100">商品名</th>
            <th class="opth70">采购数量</th>
            <th class="opth70">目标价格</th>
            <th class="opth70">操作管理员</th>
            <th class="opth70">操作时间</th>
            <th class="opth70">操作</th>
        </tr>
    </thead>
    <tbody id="tbodylist">
        <volist name="_datalist['lists']" id="g">
            <tr>
               <td><input
                      type="checkbox" class="ace"  value="{$g.listid}" > <span class="lbl"></span>
                  </td> 
                <td>{$g['purchaseame']}</td>
            	<td>{$g['goodsname']}</td>
            	<td>{$g['number']}</td>
                <td>{$g['price']}</td>
                <td>{$g['user_name']}</td>
                <td>{$g['createtime']}</td>
                <td><a href="{:U('add_wx_purchaselist',array('purchaseid'=>$g['purchaseid']))}"  >编辑</a>
                <a href="delete_wx_purchaselist?id={$g['listid']}" onclick="Javascript:return confirm('确定要删除吗？');">删除</a>
                </td>
            </tr>
        </volist>

        <empty name="_datalist['lists']">
            <tr>
                <td style="padding:30px;text-align:center;" colspan="10">
                   	 暂无相关记录
                </td>
            </tr>
        </empty>

    </tbody>
</table>
   <button class='btn btn-danger' onclick="all_delete_wx_vest()">批量删除</button>
<div class="page_list_ops dataTables_paginate paging_bootstrap pagination">
    {$_datalist['page_html']}
</div>
<script type="text/javascript">
   $(function(){
           $("#allsel").bind("click",checkSel);
    })

 function checkSel(){
   var flg= $(this).is(":checked");
   $("input[type='checkbox']").prop("checked",flg);
}
 //批量删除有效无效
function all_delete_wx_vest(){
     //获取需要删除信息
     var _val=selallval();
     if(_val==""){
         alert("请勾选需要删除的记录!");
         return false;
     }
     $.ajax({
             'url': "{:U('all_delete_wx_purchaselist')}",
             'data': {'allid':_val},
             'dataType': 'json',
             'type': 'POST',
             success: function (data) {
                 if (data.staute =="success") {  
                    alert(data.msg);
                      _load_html_byurl("{:U('select_wx_purchaselist_list')}", "load_tb_div");
                 }

             }, error: function (err) { 

                 art.dialog({title:'温馨提示',content: err.responseText, ok: function () {this.close();return false;},okval:'确定'});
             },complete: function () {
                
             }
         });

}  

var selallval=function(){
     var _list="";
     $("input[type='checkbox']:checked").each(function(){
         // var flg=$(this).is(":checked");
         //if(!flg)return false;
         var _val=$(this).val();
         if(_val!=""){
         _list+= (_list==""?"":",")+"'"+_val+"'";
         } 
     });
     return _list;
}  
</script>